import random
from ball import Ball
from coin import Coin

# 创建ball对象函数
def create_ball(screen,paddle):
    # 创建球对象
    ball = Ball(screen)
    # 加载图片
    ball.load_image("./image/3_1.png")
    # 设置大小
    ball.set_size(0.015)
    # 设置位置
    ball.set_position(screen.get_width()/2 - ball.width*ball.size/2, paddle.y - 20)
    # 设置面向方向
    ball.set_direction(random.randint(30,150))
    # 返回ball
    return ball

# 创建coin对象函数
def create_coin(screen):
    # 创建金币对象
    coin = Coin(screen)
    # 加载图片
    coin.load_image_list(["./image/coin_1.png","./image/coin_2.png","./image/coin_3.png"])
    # 设置大小
    coin.set_size(0.1)
    # 设置横向随机位置
    coin.set_position(random.randint(coin.width * coin.size, screen.get_width() - coin.width * coin.size), 10)
    # 随机设置造型
    coin.change_random_image()
    # 设置面向方向
    coin.set_direction(90)
    # 返回coin
    return coin